package clientMain;
// <editor-fold defaultstate="collapsed" desc="Imports">
import client_V1.ClientThreadV1;
import client_V2.ClientThreadV2;
import java.io.IOException;
import java.net.UnknownHostException;
import java.util.Scanner;
import java.util.logging.Level;
import java.util.logging.Logger;
// </editor-fold>

/**
 * @file Client.java
 *
 * @version 0.1
 * @author Chris Sewell 10008342
 */
public class Client {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String host = "localhost";
        int port = 3434;
        int version;
        
        //Get version of assignment
        System.out.print("Version 1/2: ");
        version = scan.nextInt();
        switch (version) {
            case 1: {
                //Create new client thread and socket request for version client/server 1
                ClientThreadV1 client;
                try {
                    client = new ClientThreadV1(host, port);
                    client.start();
                } catch (UnknownHostException ex) {
                    Logger.getLogger(Client.class.getName()).log(Level.SEVERE, null, ex);
                } catch (IOException ex) {
                    Logger.getLogger(Client.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
            break;
            case 2: {
                //Create new client thread and socket request for version client/server 1
                ClientThreadV2 client;
                try {
                    client = new ClientThreadV2(host, port);
                    client.start();
                } catch (UnknownHostException ex) {
                    Logger.getLogger(Client.class.getName()).log(Level.SEVERE, null, ex);
                } catch (IOException ex) {
                    Logger.getLogger(Client.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
            break;
        }
    }
}
